<?php
include_once('prepend.inc.php');

class pnlHeader extends QPanel
{
	public $lnkMyLibrary;
	public $lnkAmazonSearch;
	public $lnkAddContact;
	public $lnkShareAssets;
	public $lnkAssetLog;
	
	public $strClosePanelMethod;
	
	public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null)
	{
		// Call the Parent
		try {
			parent::__construct($objParentObject, $strControlId);
		} catch (QCallerException $objExc) {
			$objExc->IncrementOffset();
			throw $objExc;
		}
		
		// Setup Callback and Template
		$this->strTemplate = 'Panel/pnlHeader.tpl.php';
		$this->strClosePanelMethod = $strClosePanelMethod;

		$this->Form_Create();
		
	}
	
	protected function Form_Create()
	{
		$this->LinkCreate();
	}
	
	protected function LinkCreate()
	{
		$this->lnkMyLibrary = new QLinkButton($this);
		$this->lnkMyLibrary->Text = "My Library";
		$this->lnkMyLibrary->AddAction(new QClickEvent(),new QServerAction('lnkMyLibrary_Click'));
			
		$this->lnkAmazonSearch = new QLinkButton($this);
		$this->lnkAmazonSearch->Text = "Add an Asset";
		$this->lnkAmazonSearch->AddAction(new QClickEvent(),new QServerAction('lnkAmazonSearch_Click'));
			

		$this->lnkAddContact = new QLinkButton($this);
		$this->lnkAddContact->Text = "Add a new Contact";
		$this->lnkAddContact->AddAction(new QClickEvent(),new QServerAction('lnkAddContact_Click'));
		
		$this->lnkShareAssets = new QLinkButton($this);
		$this->lnkShareAssets->Text = "Share your Assets";
		$this->lnkShareAssets->AddAction(new QClickEvent(),new QServerAction('lnkShareAssets_Click'));
		
		$this->lnkAssetLog = new QLinkButton($this);
		$this->lnkShareAssets->Text = "Asset History";
		$this->lnkShareAssets->AddAction(new QClickEvent(),new QServerAction('lnkAssetLog_Click'));
	
	}
	
	protected function lnkAssetLog_Click()
	{
		QApplicationBase::Redirect('AssetLog.php');
	}
	
	protected function lnkAddContact_Click()
	{
		QApplicationBase::Redirect('peopledetails_list.php');
	}

	protected function lnkMyLibrary_Click()
	{
		QApplication::Redirect('MyLibrary.php');
	}
		
	protected function lnkShareAssets_Click()
	{
		QApplication::Redirect('ShareAssets.php');
	}

	protected function lnkAmazonSearch_Click()
	{
		QApplication::Redirect('AmazonSearch.php');
	}
	
	
	// 	Close Myself and Call ClosePanelMethod Callback
	protected function CloseSelf($blnChangesMade) 
	{
		$strMethod = $this->strClosePanelMethod;
		$this->objForm->$strMethod($blnChangesMade);
	}
}
?>